from core.document_processing import process_documents
from core.knowledge_graph import build_knowledge_graph
from core.route_generator import generate_synthesis_routes
from core.optimization import optimize_routes
import yaml


def main():
    """项目主入口函数"""
    try:
        # 加载配置文件
        with open('config/paths.yaml') as f:
            paths = yaml.safe_load(f)
        
        print("启动药物合成AI系统...")
        
        # 执行核心流程
        process_documents()
        build_knowledge_graph()
        routes = generate_synthesis_routes()
        optimize_routes(routes)
        
        print(f"处理结果已保存至：{paths['output_dir']}")
        
    except Exception as e:
        print(f"系统运行异常：{str(e)}")
        

if __name__ == "__main__":
    main()